package JUnit;



import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.junit.Test;

import Model.user;

public class TestC3P0 {
	@Test
	public void test1(){
		Configuration cfg = new Configuration().configure();
		SessionFactory sf= cfg.buildSessionFactory();
		Session session = sf.openSession();
		Transaction t= session.beginTransaction();
		user u = session.load(user.class, 1);
		t.commit();
		
		System.out.println("用户名:"+u.getUsername());
		try {
			Thread.sleep(5000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		session.close();
	}
	
	@Test
	public void test2(){
	}
}	
